<form class="layui-form layui-form-pamel" name="form1" id="form1" method="post">
    <div class="searchbox demoTable" id="searchbox">
        <div class="layui-form-item">
            <div class="layui-inline">
                <label class="layui-form-label">串口号：</label>
                <div class="layui-input-inline">
                    <input class="layui-input" type="text" maxlength="50" name="comid" id="comid"
                           placeholder="请输入串口号"/>
                </div>
            </div>
            <div class="layui-inline">
                <label class="layui-form-label">UDP端口号：</label>
                <div class="layui-input-inline">
                    <input class="layui-input" type="text" maxlength="50" name="udpport" id="udpport"
                           placeholder="请输入UDP接收端口号"/>
                </div>
            </div>
            <div class="layui-inline">
                <label class="layui-form-label">通讯方式：</label>
                <div class="layui-input-inline">
                    <select name="contact" id="contact" lay-filter="contact">
                        <option value="1">混合方式</option>
                        <option value="2">单一串口</option>
                    </select>
                </div>
            </div>
            <input type="button" value="查询" onclick="$.table.search()" class="layui-btn layui-btn-red"/>
        </div>
    </div>
</form>

<div style="overflow:auto;width: 100%;padding-bottom: 20px;">
    <table id="simple-table" class="layui-table" lay-filter="simple-table">
    </table>
    <script type="text/html" id="barTable">
        <a class="layui-btn layui-btn-xs layui-btn-normal" lay-event="detailsFlag" title="详情">详情</a>
        <a class="layui-btn layui-btn-xs layui-btn-normal" lay-event="editFlag" title="编辑">编辑</a>
        <a class="layui-btn layui-btn-xs layui-btn-normal" lay-event="delFlag" title="删除">删除</a>
    </script>

    <script type="text/html" id="toolbarTable">
        <div class="layui-inline" title="添加" lay-event="addFlag"><i class="layui-icon layui-icon-add-circle"></i></div>
        <div class="layui-inline" title="导出" lay-event="exportExcel"><i class="layui-icon layui-icon-export"></i></div>
    </script>
</div>

<script type="text/javascript">
    layui.use(['form', 'table'], function () {
        var form = layui.form;
        form.render();

    });

    var prefix = basePath + "facilities/underdata";

    var options = {
        id: 'simple-table',
        url: prefix + '/monitorUnderParameterlistPage',
        javaField: 'comid',    //主键
        addUrl: prefix + '/addMonitorUnderParameter',   //添加
        deleteUrl: prefix + '/deleteMonitorUnderParameter',    //删除
        editUrl: prefix + '/toEditMonitorUnderParameter?comid=',   //编辑
        exportUrl: prefix + '/exportMonitorUnderParameter',    //导出
        importTemplate: prefix + '/impTempMonitorUnderParameter',   //下载导入模板
        importTemplateUrl: prefix + '/impTempMonitorUnderParameterUrl',    //导入
        width: 500,  //开启头部工具栏右侧
        height: 400,  //开启头部工具栏右侧
        addFull: false, //弹出框最大化
        editFull: false, //弹出框最大化
        toolbar: '#toolbarTable',  //开启工具栏
        modalName: '井下分站参数设置',
        cols: [[
            {type: 'numbers', title: '序号', width: 50}
            , {field: 'comid', title: '串口号'}
            , {field: 'udpport', title: 'UDP接收端口号'}
            , {field: 'contact', title: '通讯方式',templet:function (d) {
                    if(d.contact == '1'){
                        return '混合方式';
                    }else if(d.contact == '2'){
                        return '单一串口';
                    }else{
                        return '未知';
                    }
                }}
            , {title: '操作', width: 178, align: 'center', toolbar: '#barTable'}
        ]],
        page: true
    };

    var init = $.table.init(options);

</script>
